package merchants;

import merchants.security.AuthCheckInterceptor;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;


@SpringBootApplication
public class PassbookApplication implements WebMvcConfigurer {

    @Resource
    private AuthCheckInterceptor authCheckInterceptor;
	public static void main(String[] args) {
		SpringApplication.run(PassbookApplication.class, args);
	}

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
	    registry.addInterceptor(authCheckInterceptor)
                .addPathPatterns("/merchants/**");
    }
}
